package com.example.student.controller;

import com.example.apiservice.client.TestClient;
import com.example.common.domain.Result;
import com.example.common.domain.pojo.Course;
import com.example.common.domain.pojo.CourseOutline;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

@Api(value = "学生端Test接口", description = "学生签到")
@RestController
@RefreshScope//时时刷新配置信息
@Slf4j  //日志  log.info("登录日志测试：");
@RequestMapping("/students")
@RequiredArgsConstructor
public class StudentTestController {

    @Autowired
    private TestClient testClient;

    @ApiOperation("测试接口")
    @GetMapping("/test")
    public String test() {
        return testClient.test();
    }

    @ApiOperation("测试接口")
    @PostMapping("/TestPost")
    public Result<Course> TestPost(@RequestBody Course course) {
        return testClient.TestPost(course);
    }

    @ApiOperation("测试接口")
    @GetMapping("/getCourseById/{id}")
    public Result<Course> getCourseById(@PathVariable String id) {
        return testClient.getCourseById(id);
    }

    @ApiOperation("测试接口")
    @GetMapping("/getCourseOutline/{courseId}")
    public Result<CourseOutline> getCourseOutline(@PathVariable String courseId) {
        return testClient.getCourseOutline(courseId);
    }
}
